/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.chris.cc.oauth2.service.http;

import com.chris.cc.common.user.Permission;
import com.chris.cc.common.user.Role;
import com.chris.cc.common.user.User;
import com.chris.cc.common.web.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
/**
 * Copyright (c) 2018-2025, chris All rights reserved.
 * <p>
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * <p>
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: haoka (haokang207@126.com)
 * Date: 2018/8/24 14:35
 **/
@FeignClient(name = "cc-user", fallback = UserClientFallback.class)
public interface UserClient {
    /**
     * 通过手机号查询用户信息
     *
     * @param tel 手机号
     * @return
     */
    @GetMapping("/user/get/{tel}")
    R<User> getUserByTel(@PathVariable("tel") String tel);

    /**
     * 通过userId查询角色信息
     *
     * @param userId
     * @return
     */
    @GetMapping("/role/get/{userId}")
    R<List<Role>> getRolesByUserId(@PathVariable("userId") Long userId);

    /**
     * 根据userId查询用户权限信息
     *
     * @param userId
     * @return
     */
    @GetMapping("/permission/get/{userId}")
    R<List<Permission>> getPermissionsByUserId(@PathVariable("userId") Long userId);
}
